package com.wmh.baseservice.robot.config;

import com.wmh.baseservice.robot.entity.RobotApiUri;
import com.wmh.baseservice.robot.service.RobotApiUriService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author 青石
 */
@Configuration
public class ApiConfig {

    @Resource
    private RobotApiUriService robotApiUriService;

    @Bean
    public Map<String, RobotApiUri> robotApiMap(){
        List<RobotApiUri> list = robotApiUriService.list();
        HashMap<String, RobotApiUri> map = new HashMap<>(10);
        list.forEach(e ->{
           map.put(e.getName(),e);
        });
        return map;
    }
}
